﻿using System.Linq;
using System.Text;
using System.Diagnostics;
using System.Runtime.Serialization;
using System.Collections;
using System.Data;
using System.ComponentModel;
using System.Data.OracleClient;
namespace INTEX.DataBase.Tools
{
    public partial class INTEXDBC
    {
        public void MapBHSATZ(ref DataRow dwLocal, DataRow dwData)
        {
            BlindMap(ref dwLocal, dwData);
        }
        public void SaveBHSATZ(DataRow dwData, DataRow dwDispo)
        {
            DataSet setResult = new DataSet();
            DataTable tbLocal = null;
            DataRow dwLocal = null;
            bool flgExist = false;
            setResult = QueryBHSATZ(dwData);
            if (setResult.Tables.Count > 0)
            {
                tbLocal = setResult.Tables[0];
                if (tbLocal.Rows.Count > 0)
                {
                    flgExist = true;
                    dwLocal = tbLocal.Rows[0];
                }
                else
                {
                    dwLocal = tbLocal.NewRow();
                }
            }

            MapBHSATZ(ref dwLocal, dwData);

            if (!flgExist)
            {
                InsertBHSATZ(dwLocal);
            }
            UpdateBHSATZ(dwLocal);
        }
        public void InsertBHSATZ(DataRow dwData, string ITXDBVERSION = "50.24")
        {
            OracleCommand or1;
            or1 = OracleDB.CreateCommand();
            or1.CommandText = "INSERT INTO BHSATZ(BHMANDANT,BHKART,BHKVAR,BHAENDZL,BHAENDBEN,BHAENDDAT,BHNEUBEN,BHNEUDAT,BHFERTKZ,BHLIEFNR,BHFILLER1,BHLAN,BHKUNDNR,BHHERART,BHSTATUS,BHSTAKZ,BHGASTUE,BHBASTUE,BHAUFTR,BHKGNET,BHLGG,BHRSP,BHSCHLIGR1,BHSCHLIGR2,BHSCHLIGR3,BHSCHLIGR4,BHSCHLIGR5,BHSCHLIGR6,BHSCHLIGR7,BHSCHLIGR8,BHSCHLIGR9,BHSCHLIGR10,BHSCHLIGR11,BHSCHLIGR12,BHSCHLIGR13,BHSCHLIGR14,BHSCHLIGR15,BHSCHLINR1,BHSCHLINR2,BHSCHLINR3,BHSCHLINR4,BHSCHLINR5,BHSCHLINR6,BHSCHLINR7,BHSCHLINR8,BHSCHLINR9,BHSCHLINR10,BHSCHLINR11,BHSCHLINR12,BHSCHLINR13,BHSCHLINR14,BHSCHLINR15,BHCADKEY,BHBEM,BHDEKPR,BHZUGMENG,BHVRPR,BHLEPR,BHBWPR1,BHBWPR2,BHBWPR3,BHMATKTO,BHKTO1,BHEG,BHBON,BHZUSCHL11,BHZUSCHL12,BHZUSCHL13,BHZUSCHL21,BHZUSCHL22,BHZUSCHL23,BHABSABF,BHKALABF,BHAUFKZ,BHKETTLG,BHFERTZT,BHWDBSZT,BHDISPOKZ,BHDISPOZR,BHMINBST,BHMAXBST,BHBSLPKT,BHLO,BHLB,BHABCKL,BHSACHDSP,BHPROF,BHPRUEFANW,BHTAX,BHBKLAS,BHSCHLIAUF,BHFILLER)"
                + "VALUES (:BHMANDANT,:BHKART,:BHKVAR,:BHAENDZL,:BHAENDBEN,:BHAENDDAT,:BHNEUBEN,:BHNEUDAT,:BHFERTKZ,:BHLIEFNR,:BHFILLER1,:BHLAN,:BHKUNDNR,:BHHERART,:BHSTATUS,:BHSTAKZ,:BHGASTUE,:BHBASTUE,:BHAUFTR,:BHKGNET,:BHLGG,:BHRSP,:BHSCHLIGR1,:BHSCHLIGR2,:BHSCHLIGR3,:BHSCHLIGR4,:BHSCHLIGR5,:BHSCHLIGR6,:BHSCHLIGR7,:BHSCHLIGR8,:BHSCHLIGR9,:BHSCHLIGR10,:BHSCHLIGR11,:BHSCHLIGR12,:BHSCHLIGR13,:BHSCHLIGR14,:BHSCHLIGR15,:BHSCHLINR1,:BHSCHLINR2,:BHSCHLINR3,:BHSCHLINR4,:BHSCHLINR5,:BHSCHLINR6,:BHSCHLINR7,:BHSCHLINR8,:BHSCHLINR9,:BHSCHLINR10,:BHSCHLINR11,:BHSCHLINR12,:BHSCHLINR13,:BHSCHLINR14,:BHSCHLINR15,:BHCADKEY,:BHBEM,:BHDEKPR,:BHZUGMENG,:BHVRPR,:BHLEPR,:BHBWPR1,:BHBWPR2,:BHBWPR3,:BHMATKTO,:BHKTO1,:BHEG,:BHBON,:BHZUSCHL11,:BHZUSCHL12,:BHZUSCHL13,:BHZUSCHL21,:BHZUSCHL22,:BHZUSCHL23,:BHABSABF,:BHKALABF,:BHAUFKZ,:BHKETTLG,:BHFERTZT,:BHWDBSZT,:BHDISPOKZ,:BHDISPOZR,:BHMINBST,:BHMAXBST,:BHBSLPKT,:BHLO,:BHLB,:BHABCKL,:BHSACHDSP,:BHPROF,:BHPRUEFANW,:BHTAX,:BHBKLAS,:BHSCHLIAUF,:BHFILLER)";
            or1.Parameters.Add("BHMANDANT", OracleType.NVarChar).Value = dwData["BHMANDANT"].ToString();
            or1.Parameters.Add("BHKART", OracleType.NVarChar).Value = dwData["BHKART"].ToString();
            or1.Parameters.Add("BHKVAR", OracleType.NVarChar).Value = dwData["BHKVAR"].ToString();
            or1.Parameters.Add("BHAENDZL", OracleType.NVarChar).Value = dwData["BHAENDZL"].ToString();
            or1.Parameters.Add("BHAENDBEN", OracleType.NVarChar).Value = dwData["BHAENDBEN"].ToString();
            or1.Parameters.Add("BHAENDDAT", OracleType.NVarChar).Value = dwData["BHAENDDAT"].ToString();
            or1.Parameters.Add("BHNEUBEN", OracleType.NVarChar).Value = dwData["BHNEUBEN"].ToString();
            or1.Parameters.Add("BHNEUDAT", OracleType.NVarChar).Value = dwData["BHNEUDAT"].ToString();
            or1.Parameters.Add("BHFERTKZ", OracleType.NVarChar).Value = dwData["BHFERTKZ"].ToString();
            or1.Parameters.Add("BHLIEFNR", OracleType.NVarChar).Value = dwData["BHLIEFNR"].ToString();
            or1.Parameters.Add("BHFILLER1", OracleType.NVarChar).Value = dwData["BHFILLER1"].ToString();
            or1.Parameters.Add("BHLAN", OracleType.NVarChar).Value = dwData["BHLAN"].ToString();
            or1.Parameters.Add("BHKUNDNR", OracleType.NVarChar).Value = dwData["BHKUNDNR"].ToString();
            or1.Parameters.Add("BHHERART", OracleType.NVarChar).Value = dwData["BHHERART"].ToString();
            or1.Parameters.Add("BHSTATUS", OracleType.NVarChar).Value = dwData["BHSTATUS"].ToString();
            or1.Parameters.Add("BHSTAKZ", OracleType.NVarChar).Value = dwData["BHSTAKZ"].ToString();
            or1.Parameters.Add("BHGASTUE", OracleType.NVarChar).Value = dwData["BHGASTUE"].ToString();
            or1.Parameters.Add("BHBASTUE", OracleType.NVarChar).Value = dwData["BHBASTUE"].ToString();
            or1.Parameters.Add("BHAUFTR", OracleType.NVarChar).Value = dwData["BHAUFTR"].ToString();
            or1.Parameters.Add("BHKGNET", OracleType.NVarChar).Value = dwData["BHKGNET"].ToString();
            or1.Parameters.Add("BHLGG", OracleType.NVarChar).Value = dwData["BHLGG"].ToString();
            or1.Parameters.Add("BHRSP", OracleType.NVarChar).Value = dwData["BHRSP"].ToString();
            or1.Parameters.Add("BHSCHLIGR1", OracleType.NVarChar).Value = dwData["BHSCHLIGR1"].ToString();
            or1.Parameters.Add("BHSCHLIGR2", OracleType.NVarChar).Value = dwData["BHSCHLIGR2"].ToString();
            or1.Parameters.Add("BHSCHLIGR3", OracleType.NVarChar).Value = dwData["BHSCHLIGR3"].ToString();
            or1.Parameters.Add("BHSCHLIGR4", OracleType.NVarChar).Value = dwData["BHSCHLIGR4"].ToString();
            or1.Parameters.Add("BHSCHLIGR5", OracleType.NVarChar).Value = dwData["BHSCHLIGR5"].ToString();
            or1.Parameters.Add("BHSCHLIGR6", OracleType.NVarChar).Value = dwData["BHSCHLIGR6"].ToString();
            or1.Parameters.Add("BHSCHLIGR7", OracleType.NVarChar).Value = dwData["BHSCHLIGR7"].ToString();
            or1.Parameters.Add("BHSCHLIGR8", OracleType.NVarChar).Value = dwData["BHSCHLIGR8"].ToString();
            or1.Parameters.Add("BHSCHLIGR9", OracleType.NVarChar).Value = dwData["BHSCHLIGR9"].ToString();
            or1.Parameters.Add("BHSCHLIGR10", OracleType.NVarChar).Value = dwData["BHSCHLIGR10"].ToString();
            or1.Parameters.Add("BHSCHLIGR11", OracleType.NVarChar).Value = dwData["BHSCHLIGR11"].ToString();
            or1.Parameters.Add("BHSCHLIGR12", OracleType.NVarChar).Value = dwData["BHSCHLIGR12"].ToString();
            or1.Parameters.Add("BHSCHLIGR13", OracleType.NVarChar).Value = dwData["BHSCHLIGR13"].ToString();
            or1.Parameters.Add("BHSCHLIGR14", OracleType.NVarChar).Value = dwData["BHSCHLIGR14"].ToString();
            or1.Parameters.Add("BHSCHLIGR15", OracleType.NVarChar).Value = dwData["BHSCHLIGR15"].ToString();
            or1.Parameters.Add("BHSCHLINR1", OracleType.NVarChar).Value = dwData["BHSCHLINR1"].ToString();
            or1.Parameters.Add("BHSCHLINR2", OracleType.NVarChar).Value = dwData["BHSCHLINR2"].ToString();
            or1.Parameters.Add("BHSCHLINR3", OracleType.NVarChar).Value = dwData["BHSCHLINR3"].ToString();
            or1.Parameters.Add("BHSCHLINR4", OracleType.NVarChar).Value = dwData["BHSCHLINR4"].ToString();
            or1.Parameters.Add("BHSCHLINR5", OracleType.NVarChar).Value = dwData["BHSCHLINR5"].ToString();
            or1.Parameters.Add("BHSCHLINR6", OracleType.NVarChar).Value = dwData["BHSCHLINR6"].ToString();
            or1.Parameters.Add("BHSCHLINR7", OracleType.NVarChar).Value = dwData["BHSCHLINR7"].ToString();
            or1.Parameters.Add("BHSCHLINR8", OracleType.NVarChar).Value = dwData["BHSCHLINR8"].ToString();
            or1.Parameters.Add("BHSCHLINR9", OracleType.NVarChar).Value = dwData["BHSCHLINR9"].ToString();
            or1.Parameters.Add("BHSCHLINR10", OracleType.NVarChar).Value = dwData["BHSCHLINR10"].ToString();
            or1.Parameters.Add("BHSCHLINR11", OracleType.NVarChar).Value = dwData["BHSCHLINR11"].ToString();
            or1.Parameters.Add("BHSCHLINR12", OracleType.NVarChar).Value = dwData["BHSCHLINR12"].ToString();
            or1.Parameters.Add("BHSCHLINR13", OracleType.NVarChar).Value = dwData["BHSCHLINR13"].ToString();
            or1.Parameters.Add("BHSCHLINR14", OracleType.NVarChar).Value = dwData["BHSCHLINR14"].ToString();
            or1.Parameters.Add("BHSCHLINR15", OracleType.NVarChar).Value = dwData["BHSCHLINR15"].ToString();
            or1.Parameters.Add("BHCADKEY", OracleType.NVarChar).Value = dwData["BHCADKEY"].ToString();
            or1.Parameters.Add("BHBEM", OracleType.NVarChar).Value = dwData["BHBEM"].ToString();
            or1.Parameters.Add("BHDEKPR", OracleType.NVarChar).Value = dwData["BHDEKPR"].ToString();
            or1.Parameters.Add("BHZUGMENG", OracleType.NVarChar).Value = dwData["BHZUGMENG"].ToString();
            or1.Parameters.Add("BHVRPR", OracleType.NVarChar).Value = dwData["BHVRPR"].ToString();
            or1.Parameters.Add("BHLEPR", OracleType.NVarChar).Value = dwData["BHLEPR"].ToString();
            or1.Parameters.Add("BHBWPR1", OracleType.NVarChar).Value = dwData["BHBWPR1"].ToString();
            or1.Parameters.Add("BHBWPR2", OracleType.NVarChar).Value = dwData["BHBWPR2"].ToString();
            or1.Parameters.Add("BHBWPR3", OracleType.NVarChar).Value = dwData["BHBWPR3"].ToString();
            or1.Parameters.Add("BHMATKTO", OracleType.NVarChar).Value = dwData["BHMATKTO"].ToString();
            or1.Parameters.Add("BHKTO1", OracleType.NVarChar).Value = dwData["BHKTO1"].ToString();
            or1.Parameters.Add("BHEG", OracleType.NVarChar).Value = dwData["BHEG"].ToString();
            or1.Parameters.Add("BHBON", OracleType.NVarChar).Value = dwData["BHBON"].ToString();
            or1.Parameters.Add("BHZUSCHL11", OracleType.NVarChar).Value = dwData["BHZUSCHL11"].ToString();
            or1.Parameters.Add("BHZUSCHL12", OracleType.NVarChar).Value = dwData["BHZUSCHL12"].ToString();
            or1.Parameters.Add("BHZUSCHL13", OracleType.NVarChar).Value = dwData["BHZUSCHL13"].ToString();
            or1.Parameters.Add("BHZUSCHL21", OracleType.NVarChar).Value = dwData["BHZUSCHL21"].ToString();
            or1.Parameters.Add("BHZUSCHL22", OracleType.NVarChar).Value = dwData["BHZUSCHL22"].ToString();
            or1.Parameters.Add("BHZUSCHL23", OracleType.NVarChar).Value = dwData["BHZUSCHL23"].ToString();
            or1.Parameters.Add("BHABSABF", OracleType.NVarChar).Value = dwData["BHABSABF"].ToString();
            or1.Parameters.Add("BHKALABF", OracleType.NVarChar).Value = dwData["BHKALABF"].ToString();
            or1.Parameters.Add("BHAUFKZ", OracleType.NVarChar).Value = dwData["BHAUFKZ"].ToString();
            or1.Parameters.Add("BHKETTLG", OracleType.NVarChar).Value = dwData["BHKETTLG"].ToString();
            or1.Parameters.Add("BHFERTZT", OracleType.NVarChar).Value = dwData["BHFERTZT"].ToString();
            or1.Parameters.Add("BHWDBSZT", OracleType.NVarChar).Value = dwData["BHWDBSZT"].ToString();
            or1.Parameters.Add("BHDISPOKZ", OracleType.NVarChar).Value = dwData["BHDISPOKZ"].ToString();
            or1.Parameters.Add("BHDISPOZR", OracleType.NVarChar).Value = dwData["BHDISPOZR"].ToString();
            or1.Parameters.Add("BHMINBST", OracleType.NVarChar).Value = dwData["BHMINBST"].ToString();
            or1.Parameters.Add("BHMAXBST", OracleType.NVarChar).Value = dwData["BHMAXBST"].ToString();
            or1.Parameters.Add("BHBSLPKT", OracleType.NVarChar).Value = dwData["BHBSLPKT"].ToString();
            or1.Parameters.Add("BHLO", OracleType.NVarChar).Value = dwData["BHLO"].ToString();
            or1.Parameters.Add("BHLB", OracleType.NVarChar).Value = dwData["BHLB"].ToString();
            or1.Parameters.Add("BHABCKL", OracleType.NVarChar).Value = dwData["BHABCKL"].ToString();
            or1.Parameters.Add("BHSACHDSP", OracleType.NVarChar).Value = dwData["BHSACHDSP"].ToString();
            or1.Parameters.Add("BHPROF", OracleType.NVarChar).Value = dwData["BHPROF"].ToString();
            or1.Parameters.Add("BHPRUEFANW", OracleType.NVarChar).Value = dwData["BHPRUEFANW"].ToString();
            or1.Parameters.Add("BHTAX", OracleType.NVarChar).Value = dwData["BHTAX"].ToString();
            or1.Parameters.Add("BHBKLAS", OracleType.NVarChar).Value = dwData["BHBKLAS"].ToString();
            or1.Parameters.Add("BHSCHLIAUF", OracleType.NVarChar).Value = dwData["BHSCHLIAUF"].ToString();
            or1.Parameters.Add("BHFILLER", OracleType.NVarChar).Value = dwData["BHFILLER"].ToString(); 
            setResult = Connect2Proxy(or1);
        }
        public void DeleteBHSATZ(string client, string art, string var)
        {

            OracleCommand or1;

            or1 = OracleDB.CreateCommand();
            or1.CommandText = "DELETE BHSATZ"
           + " WHERE BHMANDANT=:BHMANDANT AND BHKART=:BHKART AND BHKVAR=:BHKVAR";
            or1.Parameters.Add("BHMANDANT", OracleType.NVarChar).Value = client;
            or1.Parameters.Add("BHKART", OracleType.NVarChar).Value = art;
            or1.Parameters.Add("BHKVAR", OracleType.NVarChar).Value = var;
            Connect2Proxy(or1);
        }
        public void UpdateBHSATZ(DataRow dwData, string ITXDBVERSION = "50.24")
        {
            OracleCommand or1;
            or1 = OracleDB.CreateCommand();
            or1.CommandText = "UPDATE BHSATZ SET "
                + "BHMANDANT=:BHMANDANT,"
                + "BHKART=:BHKART,"
                + "BHKVAR=:BHKVAR,"
                + "BHAENDZL=:BHAENDZL,"
                + "BHAENDBEN=:BHAENDBEN,"
                + "BHAENDDAT=:BHAENDDAT,"
                + "BHNEUBEN=:BHNEUBEN,"
                + "BHNEUDAT=:BHNEUDAT,"
                + "BHFERTKZ=:BHFERTKZ,"
                + "BHLIEFNR=:BHLIEFNR,"
                + "BHFILLER1=:BHFILLER1,"
                + "BHLAN=:BHLAN,"
                + "BHKUNDNR=:BHKUNDNR,"
                + "BHHERART=:BHHERART,"
                + "BHSTATUS=:BHSTATUS,"
                + "BHSTAKZ=:BHSTAKZ,"
                + "BHGASTUE=:BHGASTUE,"
                + "BHBASTUE=:BHBASTUE,"
                + "BHAUFTR=:BHAUFTR,"
                + "BHKGNET=:BHKGNET,"
                + "BHLGG=:BHLGG,"
                + "BHRSP=:BHRSP,"
                + "BHSCHLIGR1=:BHSCHLIGR1,"
                + "BHSCHLIGR2=:BHSCHLIGR2,"
                + "BHSCHLIGR3=:BHSCHLIGR3,"
                + "BHSCHLIGR4=:BHSCHLIGR4,"
                + "BHSCHLIGR5=:BHSCHLIGR5,"
                + "BHSCHLIGR6=:BHSCHLIGR6,"
                + "BHSCHLIGR7=:BHSCHLIGR7,"
                + "BHSCHLIGR8=:BHSCHLIGR8,"
                + "BHSCHLIGR9=:BHSCHLIGR9,"
                + "BHSCHLIGR10=:BHSCHLIGR10,"
                + "BHSCHLIGR11=:BHSCHLIGR11,"
                + "BHSCHLIGR12=:BHSCHLIGR12,"
                + "BHSCHLIGR13=:BHSCHLIGR13,"
                + "BHSCHLIGR14=:BHSCHLIGR14,"
                + "BHSCHLIGR15=:BHSCHLIGR15,"
                + "BHSCHLINR1=:BHSCHLINR1,"
                + "BHSCHLINR2=:BHSCHLINR2,"
                + "BHSCHLINR3=:BHSCHLINR3,"
                + "BHSCHLINR4=:BHSCHLINR4,"
                + "BHSCHLINR5=:BHSCHLINR5,"
                + "BHSCHLINR6=:BHSCHLINR6,"
                + "BHSCHLINR7=:BHSCHLINR7,"
                + "BHSCHLINR8=:BHSCHLINR8,"
                + "BHSCHLINR9=:BHSCHLINR9,"
                + "BHSCHLINR10=:BHSCHLINR10,"
                + "BHSCHLINR11=:BHSCHLINR11,"
                + "BHSCHLINR12=:BHSCHLINR12,"
                + "BHSCHLINR13=:BHSCHLINR13,"
                + "BHSCHLINR14=:BHSCHLINR14,"
                + "BHSCHLINR15=:BHSCHLINR15,"
                + "BHCADKEY=:BHCADKEY,"
                + "BHBEM=:BHBEM,"
                + "BHDEKPR=:BHDEKPR,"
                + "BHZUGMENG=:BHZUGMENG,"
                + "BHVRPR=:BHVRPR,"
                + "BHLEPR=:BHLEPR,"
                + "BHBWPR1=:BHBWPR1,"
                + "BHBWPR2=:BHBWPR2,"
                + "BHBWPR3=:BHBWPR3,"
                + "BHMATKTO=:BHMATKTO,"
                + "BHKTO1=:BHKTO1,"
                + "BHEG=:BHEG,"
                + "BHBON=:BHBON,"
                + "BHZUSCHL11=:BHZUSCHL11,"
                + "BHZUSCHL12=:BHZUSCHL12,"
                + "BHZUSCHL13=:BHZUSCHL13,"
                + "BHZUSCHL21=:BHZUSCHL21,"
                + "BHZUSCHL22=:BHZUSCHL22,"
                + "BHZUSCHL23=:BHZUSCHL23,"
                + "BHABSABF=:BHABSABF,"
                + "BHKALABF=:BHKALABF,"
                + "BHAUFKZ=:BHAUFKZ,"
                + "BHKETTLG=:BHKETTLG,"
                + "BHFERTZT=:BHFERTZT,"
                + "BHWDBSZT=:BHWDBSZT,"
                + "BHDISPOKZ=:BHDISPOKZ,"
                + "BHDISPOZR=:BHDISPOZR,"
                + "BHMINBST=:BHMINBST,"
                + "BHMAXBST=:BHMAXBST,"
                + "BHBSLPKT=:BHBSLPKT,"
                + "BHLO=:BHLO,"
                + "BHLB=:BHLB,"
                + "BHABCKL=:BHABCKL,"
                + "BHSACHDSP=:BHSACHDSP,"
                + "BHPROF=:BHPROF,"
                + "BHPRUEFANW=:BHPRUEFANW,"
                + "BHTAX=:BHTAX,"
                + "BHFILLER=:BHFILLER "
                + " WHERE  "
                + "  BHMANDANT=:BHMANDANT AND BHKART=:BHKART  AND BHKVAR=:BHKVAR";

            or1.Parameters.Add("BHMANDANT", OracleType.NVarChar).Value = dwData["BHMANDANT"].ToString();
            or1.Parameters.Add("BHKART", OracleType.NVarChar).Value = dwData["BHKART"].ToString();
            or1.Parameters.Add("BHKVAR", OracleType.NVarChar).Value = dwData["BHKVAR"].ToString();
            or1.Parameters.Add("BHAENDZL", OracleType.NVarChar).Value = dwData["BHAENDZL"].ToString();
            or1.Parameters.Add("BHAENDBEN", OracleType.NVarChar).Value = dwData["BHAENDBEN"].ToString();
            or1.Parameters.Add("BHAENDDAT", OracleType.NVarChar).Value = dwData["BHAENDDAT"].ToString();
            or1.Parameters.Add("BHNEUBEN", OracleType.NVarChar).Value = dwData["BHNEUBEN"].ToString();
            or1.Parameters.Add("BHNEUDAT", OracleType.NVarChar).Value = dwData["BHNEUDAT"].ToString();
            or1.Parameters.Add("BHFERTKZ", OracleType.NVarChar).Value = dwData["BHFERTKZ"].ToString();
            or1.Parameters.Add("BHLIEFNR", OracleType.NVarChar).Value = dwData["BHLIEFNR"].ToString();
            or1.Parameters.Add("BHFILLER1", OracleType.NVarChar).Value = dwData["BHFILLER1"].ToString();
            or1.Parameters.Add("BHLAN", OracleType.NVarChar).Value = dwData["BHLAN"].ToString();
            or1.Parameters.Add("BHKUNDNR", OracleType.NVarChar).Value = dwData["BHKUNDNR"].ToString();
            or1.Parameters.Add("BHHERART", OracleType.NVarChar).Value = dwData["BHHERART"].ToString();
            or1.Parameters.Add("BHSTATUS", OracleType.NVarChar).Value = dwData["BHSTATUS"].ToString();
            or1.Parameters.Add("BHSTAKZ", OracleType.NVarChar).Value = dwData["BHSTAKZ"].ToString();
            or1.Parameters.Add("BHGASTUE", OracleType.NVarChar).Value = dwData["BHGASTUE"].ToString();
            or1.Parameters.Add("BHBASTUE", OracleType.NVarChar).Value = dwData["BHBASTUE"].ToString();
            or1.Parameters.Add("BHAUFTR", OracleType.NVarChar).Value = dwData["BHAUFTR"].ToString();
            or1.Parameters.Add("BHKGNET", OracleType.NVarChar).Value = dwData["BHKGNET"].ToString();
            or1.Parameters.Add("BHLGG", OracleType.NVarChar).Value = dwData["BHLGG"].ToString();
            or1.Parameters.Add("BHRSP", OracleType.NVarChar).Value = dwData["BHRSP"].ToString();
            or1.Parameters.Add("BHSCHLIGR1", OracleType.NVarChar).Value = dwData["BHSCHLIGR1"].ToString();
            or1.Parameters.Add("BHSCHLIGR2", OracleType.NVarChar).Value = dwData["BHSCHLIGR2"].ToString();
            or1.Parameters.Add("BHSCHLIGR3", OracleType.NVarChar).Value = dwData["BHSCHLIGR3"].ToString();
            or1.Parameters.Add("BHSCHLIGR4", OracleType.NVarChar).Value = dwData["BHSCHLIGR4"].ToString();
            or1.Parameters.Add("BHSCHLIGR5", OracleType.NVarChar).Value = dwData["BHSCHLIGR5"].ToString();
            or1.Parameters.Add("BHSCHLIGR6", OracleType.NVarChar).Value = dwData["BHSCHLIGR6"].ToString();
            or1.Parameters.Add("BHSCHLIGR7", OracleType.NVarChar).Value = dwData["BHSCHLIGR7"].ToString();
            or1.Parameters.Add("BHSCHLIGR8", OracleType.NVarChar).Value = dwData["BHSCHLIGR8"].ToString();
            or1.Parameters.Add("BHSCHLIGR9", OracleType.NVarChar).Value = dwData["BHSCHLIGR9"].ToString();
            or1.Parameters.Add("BHSCHLIGR10", OracleType.NVarChar).Value = dwData["BHSCHLIGR10"].ToString();
            or1.Parameters.Add("BHSCHLIGR11", OracleType.NVarChar).Value = dwData["BHSCHLIGR11"].ToString();
            or1.Parameters.Add("BHSCHLIGR12", OracleType.NVarChar).Value = dwData["BHSCHLIGR12"].ToString();
            or1.Parameters.Add("BHSCHLIGR13", OracleType.NVarChar).Value = dwData["BHSCHLIGR13"].ToString();
            or1.Parameters.Add("BHSCHLIGR14", OracleType.NVarChar).Value = dwData["BHSCHLIGR14"].ToString();
            or1.Parameters.Add("BHSCHLIGR15", OracleType.NVarChar).Value = dwData["BHSCHLIGR15"].ToString();
            or1.Parameters.Add("BHSCHLINR1", OracleType.NVarChar).Value = dwData["BHSCHLINR1"].ToString();
            or1.Parameters.Add("BHSCHLINR2", OracleType.NVarChar).Value = dwData["BHSCHLINR2"].ToString();
            or1.Parameters.Add("BHSCHLINR3", OracleType.NVarChar).Value = dwData["BHSCHLINR3"].ToString();
            or1.Parameters.Add("BHSCHLINR4", OracleType.NVarChar).Value = dwData["BHSCHLINR4"].ToString();
            or1.Parameters.Add("BHSCHLINR5", OracleType.NVarChar).Value = dwData["BHSCHLINR5"].ToString();
            or1.Parameters.Add("BHSCHLINR6", OracleType.NVarChar).Value = dwData["BHSCHLINR6"].ToString();
            or1.Parameters.Add("BHSCHLINR7", OracleType.NVarChar).Value = dwData["BHSCHLINR7"].ToString();
            or1.Parameters.Add("BHSCHLINR8", OracleType.NVarChar).Value = dwData["BHSCHLINR8"].ToString();
            or1.Parameters.Add("BHSCHLINR9", OracleType.NVarChar).Value = dwData["BHSCHLINR9"].ToString();
            or1.Parameters.Add("BHSCHLINR10", OracleType.NVarChar).Value = dwData["BHSCHLINR10"].ToString();
            or1.Parameters.Add("BHSCHLINR11", OracleType.NVarChar).Value = dwData["BHSCHLINR11"].ToString();
            or1.Parameters.Add("BHSCHLINR12", OracleType.NVarChar).Value = dwData["BHSCHLINR12"].ToString();
            or1.Parameters.Add("BHSCHLINR13", OracleType.NVarChar).Value = dwData["BHSCHLINR13"].ToString();
            or1.Parameters.Add("BHSCHLINR14", OracleType.NVarChar).Value = dwData["BHSCHLINR14"].ToString();
            or1.Parameters.Add("BHSCHLINR15", OracleType.NVarChar).Value = dwData["BHSCHLINR15"].ToString();
            or1.Parameters.Add("BHCADKEY", OracleType.NVarChar).Value = dwData["BHCADKEY"].ToString();
            or1.Parameters.Add("BHBEM", OracleType.NVarChar).Value = dwData["BHBEM"].ToString();
            or1.Parameters.Add("BHDEKPR", OracleType.NVarChar).Value = dwData["BHDEKPR"].ToString();
            or1.Parameters.Add("BHZUGMENG", OracleType.NVarChar).Value = dwData["BHZUGMENG"].ToString();
            or1.Parameters.Add("BHVRPR", OracleType.NVarChar).Value = dwData["BHVRPR"].ToString();
            or1.Parameters.Add("BHLEPR", OracleType.NVarChar).Value = dwData["BHLEPR"].ToString();
            or1.Parameters.Add("BHBWPR1", OracleType.NVarChar).Value = dwData["BHBWPR1"].ToString();
            or1.Parameters.Add("BHBWPR2", OracleType.NVarChar).Value = dwData["BHBWPR2"].ToString();
            or1.Parameters.Add("BHBWPR3", OracleType.NVarChar).Value = dwData["BHBWPR3"].ToString();
            or1.Parameters.Add("BHMATKTO", OracleType.NVarChar).Value = dwData["BHMATKTO"].ToString();
            or1.Parameters.Add("BHKTO1", OracleType.NVarChar).Value = dwData["BHKTO1"].ToString();
            or1.Parameters.Add("BHEG", OracleType.NVarChar).Value = dwData["BHEG"].ToString();
            or1.Parameters.Add("BHBON", OracleType.NVarChar).Value = dwData["BHBON"].ToString();
            or1.Parameters.Add("BHZUSCHL11", OracleType.NVarChar).Value = dwData["BHZUSCHL11"].ToString();
            or1.Parameters.Add("BHZUSCHL12", OracleType.NVarChar).Value = dwData["BHZUSCHL12"].ToString();
            or1.Parameters.Add("BHZUSCHL13", OracleType.NVarChar).Value = dwData["BHZUSCHL13"].ToString();
            or1.Parameters.Add("BHZUSCHL21", OracleType.NVarChar).Value = dwData["BHZUSCHL21"].ToString();
            or1.Parameters.Add("BHZUSCHL22", OracleType.NVarChar).Value = dwData["BHZUSCHL22"].ToString();
            or1.Parameters.Add("BHZUSCHL23", OracleType.NVarChar).Value = dwData["BHZUSCHL23"].ToString();
            or1.Parameters.Add("BHABSABF", OracleType.NVarChar).Value = dwData["BHABSABF"].ToString();
            or1.Parameters.Add("BHKALABF", OracleType.NVarChar).Value = dwData["BHKALABF"].ToString();
            or1.Parameters.Add("BHAUFKZ", OracleType.NVarChar).Value = dwData["BHAUFKZ"].ToString();
            or1.Parameters.Add("BHKETTLG", OracleType.NVarChar).Value = dwData["BHKETTLG"].ToString();
            or1.Parameters.Add("BHFERTZT", OracleType.NVarChar).Value = dwData["BHFERTZT"].ToString();
            or1.Parameters.Add("BHWDBSZT", OracleType.NVarChar).Value = dwData["BHWDBSZT"].ToString();
            or1.Parameters.Add("BHDISPOKZ", OracleType.NVarChar).Value = dwData["BHDISPOKZ"].ToString();
            or1.Parameters.Add("BHDISPOZR", OracleType.NVarChar).Value = dwData["BHDISPOZR"].ToString();
            or1.Parameters.Add("BHMINBST", OracleType.NVarChar).Value = dwData["BHMINBST"].ToString();
            or1.Parameters.Add("BHMAXBST", OracleType.NVarChar).Value = dwData["BHMAXBST"].ToString();
            or1.Parameters.Add("BHBSLPKT", OracleType.NVarChar).Value = dwData["BHBSLPKT"].ToString();
            or1.Parameters.Add("BHLO", OracleType.NVarChar).Value = dwData["BHLO"].ToString();
            or1.Parameters.Add("BHLB", OracleType.NVarChar).Value = dwData["BHLB"].ToString();
            or1.Parameters.Add("BHABCKL", OracleType.NVarChar).Value = dwData["BHABCKL"].ToString();
            or1.Parameters.Add("BHSACHDSP", OracleType.NVarChar).Value = dwData["BHSACHDSP"].ToString();
            or1.Parameters.Add("BHPROF", OracleType.NVarChar).Value = dwData["BHPROF"].ToString();
            or1.Parameters.Add("BHPRUEFANW", OracleType.NVarChar).Value = dwData["BHPRUEFANW"].ToString();
            or1.Parameters.Add("BHTAX", OracleType.NVarChar).Value = dwData["BHTAX"].ToString();
            or1.Parameters.Add("BHFILLER", OracleType.NVarChar).Value = dwData["BHFILLER"].ToString();
            Connect2Proxy(or1);
        }
        public DataSet QueryBHSATZ(DataRow dwData, int option = 1)
        {
            DataSet setReturn = new DataSet();
            DataSet Result = new DataSet();
            DataTable tbLocal = null;
            OracleCommand or1;
            or1 = OracleDB.CreateCommand();
            switch (option)
            {
                case 0:
                    or1.CommandText = "SELECT * FROM BHSATZ WHERE  ROWNUM<2 ";
                    break;
                case 1:
                    or1.CommandText = "SELECT * FROM BHSATZ"
                   + " WHERE BHMANDANT=:BHMANDANT AND BHKART=:BHKART AND BHKVAR=:BHKVAR";
                    or1.Parameters.Add("BHMANDANT", OracleType.NVarChar).Value = dwData["BHMANDANT"].ToString();
                    or1.Parameters.Add("BHKART", OracleType.NVarChar).Value = dwData["BHKART"].ToString();
                    or1.Parameters.Add("BHKVAR", OracleType.NVarChar).Value = dwData["BHKVAR"].ToString();
                    break;
                case 2:
                    or1 = OracleDB.CreateCommand();
                    or1.CommandText = "SELECT DISTINCT  WF.* FROM WDECK WD "
                        + " JOIN WASTKE ON WDMANDANT=WAKMANDANT AND WDART=WAKART AND WDVAR=WAKVAR AND WDFARBE=WAKWCOL"
                        + " JOIN BHSATZ WF ON BHMANDANT=WAKMANDANT AND BHKART=WAKKART AND BHKVAR=WAKKVAR"
                        + " WHERE WDMANDANT=:WDMANDANT AND WDSA='K' AND WDTYP='B' AND WDWAKZ='F' AND WDAUFKRS=:WDAUFKRS  AND WDAUFLFD=:WDAUFLFD";
                    or1.Parameters.Add("WDMANDANT", OracleType.NVarChar).Value = dwData["WDMANDANT"].ToString();
                    or1.Parameters.Add("WDAUFKRS", OracleType.NVarChar).Value = dwData["WDAUFKRS"].ToString();
                    or1.Parameters.Add("WDAUFLFD", OracleType.NVarChar).Value = dwData["WDAUFLFD"].ToString();
                    break;
                case 3:
                    or1.CommandText = "SELECT DISTINCT M.* FROM BHSATZ M JOIN ABPOS ON ABPMANDANT=BHMANDANT AND ABPART=BHKART AND ABPVAR=BHKVAR"
                   + " WHERE ABPMANDANT=:ABPMANDANT AND ABPAUFKRS=:ABPAUFKRS AND ABPAUFLFD=:ABPAUFLFD";
                    or1.Parameters.Add("ABPMANDANT", OracleType.NVarChar).Value = dwData["ABPMANDANT"].ToString();
                    or1.Parameters.Add("ABPAUFKRS", OracleType.NVarChar).Value = dwData["ABPAUFKRS"].ToString();
                    or1.Parameters.Add("ABPAUFLFD", OracleType.NVarChar).Value = dwData["ABPAUFLFD"].ToString();
                    break;
            }
            Result = Connect2Proxy(or1);
            if (Result.Tables.Count > 0)
            {
                tbLocal = Result.Tables[0];
                tbLocal.TableName = "BHSATZ";
            }
            setReturn.Merge(Result);
            return setReturn;
        }
    }
}
